<div class="asidetop">
    <ul class="tab_navs">
        <li >
            <a onclick="getRight('/Sucai/single');"  href="javascript:void(0)">添加单图文消息</a>
        </li>
        <li >
            <a onclick="getRight('/Sucai/double');" href="javascript:void(0)">添加多图文消息</a>
        </li>
        <li>
            <a onclick="getRight('/Sucai/text');" href="javascript:void(0)">添加文本消息</a>
        </li>
        <li class="selected">
            <a onclick="getRight('/Sucai/image');" href="javascript:void(0)">添加图片消息</a>
        </li>

    </ul>
</div>
<div style="padding:30px 20px 0">


    <div class="media_preview_area">
        <div class="appmsg  editing">
            <div class="appmsg_content">
                <div class="js_appmsg_item ">
                    <h4 class="appmsg_title"><a href="javascript:void(0);">标题</a></h4>
                    <div class="appmsg_info">
                        <em class="appmsg_date"></em>
                    </div>
                    <div class="appmsg_thumb_wrp">
                        <img src="" class="js_appmsg_thumb appmsg_thumb" id="upimg"><i class="appmsg_thumb default">封面图片</i>
                    </div>
                    <p class="appmsg_desc">
                    </p>
                </div>
            </div>
        </div>
    </div>



    <div class="media_edit_area">
        <div class="appmsg_editor" style="margin-top: 0px;">
            <div class="inner" style="min-height: 150px;">

                <input type="hidden" name="cover" id="post_pic">
                <input type="hidden" name="type" value="image" />



                <div class="appmsg_edit_item">
                    <label class="frm_label">
                        <strong class="title">封面</strong>
                        <p class="js_cover_tip tips r">
                            大图片建议尺寸：360像素 * 200像素
                        </p>
                    </label>
                    <input id="file_upload" name="pib" type="file">
                </div>                   

                <div class="appmsg_edit_item">
                    <label class="frm_label">
                        <strong class="title">关键字</strong>
                        <p class="js_cover_tip tips r">
                            <input type="text" id="kw" />
                        </p>
                    </label></div>


                <div class="appmsg_edit_item content_edit">

                    <div class="tool_bar tc" id="submits">
                        <button class="btn btn_primary"  href="javascript:void(0);" >保存</button>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </div>

</div>

<script type="text/javascript">

    $(document).ready(function(){
        $("#submits").click(function(){
            var kw = $("#kw").val();
            var pic = $("#upimg").attr("src");
        
            if(kw !=""){
                $.post("/Sucai/add_image",{word:kw,cover:pic,type:"image"},function(){
                
                })
            }else{
                alert("关键词不能为空！")
            }
        
        
        });	
        
        $('#file_upload').uploadify({
            'swf'      : '/Public/js/uploadify/uploadify.swf',
            'uploader' : '/Public/js/uploadify/uploadify.php',
            'buttonText':'上传',
            'height':'25',
            'width':'60',
            'queueSizeLimit' : 1,
            'onUploadSuccess' : function(file, data, response) {
                data =  $.trim(data);
                if(data!='error'){
                    $('.js_appmsg_thumb').attr('src',data).show();
                    $('#post_pic').val(data);
                }
            },
        });
    });


</script>
